/*
 * @copyright: Huang Ding
 * @Author: ding-cx
 * @Date: 2022-04-30 11:10:44
 * @LastEditors: ding-cx
 * @LastEditTime: 2022-06-08 10:18:33
 * @Description: 钉钉事件订阅接口调用
 */

import DingTalkBasePublicService from "./BasePublicService";
import { Dingtalk } from "../dingtalk";

export default class EventService extends DingTalkBasePublicService {
	/**
	 * 获取推送失败的事件列表
	 *
	 * https://open.dingtalk.com/document/orgapp-server/obtain-the-event-list-of-failed-push-messages
	 *
	 */
	async getCallbackFailedResult() {
		const url = await this.getURL(`https://oapi.dingtalk.com/call_back/get_call_back_failed_result`);

		const res = await this.app.curl<Dingtalk.ov.IResponseGetCallbackFaildResult>(url, {
			contentType: "json",
			dataType: "json",
			method: "GET",
		});
		this.ovcheckError(url, res);
		return res.data;
	}
}
